#pragma warning(disable: 4819)
#pragma once
#include <SDL.h>
#include <SDL_image.h>
#include <SDL_mixer.h>
#include <memory>
#include "Object.h"
#include <array>
#include <random>

class Scene;

enum SceneType
{
    SceneBeginAnimation,
    SceneBegin,
    SceneGame,
    SceneMakeMap
};

class Game
{
public:
    ~Game();
    static Game& GetInstance();
    bool Init();
    void Run();
    void Clean();
    SDL_Renderer* GetRenderer() const;
    int GetWindowWidth() const;
    int GetWindowHeight() const;
    int GetRandom(int min, int max);
    
private:
    Game();
    Game(const Game& other) = delete;
    Game& operator=(const Game& other) = delete;

    void handleEvent(SDL_Event* event);
    void update(float deltaTime);   //deltaTime: 上一帧到本帧的时间间隔
    void render();
private:
    bool isRunning_ = true;
    int windowWidth_ = 780;
    int windowHeight_ = 780;
    SDL_Window* window_;
    SDL_Renderer* renderer_;
    std::unique_ptr<Scene> currentScene_;   //当前的场景

private:
    //资源
    SDL_Surface* icon_;
    std::mt19937 gen_;
};